﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace shiyan783
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        //点击 加入 按钮
        protected void Unnamed2_Click(object sender, EventArgs e)
        {
            if (ListBox1.SelectedItem == null)
                return;
            else
            {
                if (!ListBox2.Items.Contains(ListBox1.SelectedItem))
                {
                    ListBox2.Items.Add(ListBox1.SelectedItem);
                    ListBox1.Items.Remove(ListBox1.SelectedItem);
                }
            }
        }

        //点击 移除 按钮
        protected void Unnamed3_Click(object sender, EventArgs e)
        {
            if (ListBox2.SelectedItem == null)
                return;
            else
            {
                if (!ListBox1.Items.Contains(ListBox2.SelectedItem))
                {
                    ListBox1.Items.Add(ListBox2.SelectedItem);
                    ListBox2.Items.Remove(ListBox2.SelectedItem);
                }
            }
        }
    }
}
